/*0HwOR0DmpnaMMqaZq+6ERnAK5ixbubiDSo01FLyGnZg=*/
/*
 * @Author: llixxm
 * @Date: 2022-02-23 09:48:04
 * @Description: ajax
 */

import {ajax} from 'nc-lightapp-front';

export default function(params){
    let {url, data, successcb, errorcb, async} = params;
    ajax({url, data, 
        async: params.hasOwnProperty('async') && !async ? false:true, //默认异步
        success:(res) => {
            let {success, data} = res;
            if(success){
                if(typeof successcb === 'function'){
                    successcb(data);
                }
            }else{
                if(typeof errorcb === 'function'){
                    errorcb(data);
                }
            }
        }
    });
}
/*0HwOR0DmpnaMMqaZq+6ERnAK5ixbubiDSo01FLyGnZg=*/